package com.hursing.tractor.baseview;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;

public class UIImageButton extends UIButton {

	private Bitmap mImage;
	private Rect mImageSrcRect;

	public UIImageButton image(Bitmap image) {
		mImage = image;
		mImageSrcRect = new Rect(0, 0, image.getWidth(), image.getHeight());
		return this;
	}
	
	@Override
	protected void doDraw (Canvas canvas) {
		super.doDraw(canvas);
		canvas.drawBitmap(mImage, mImageSrcRect, mFrame, null);
	}
	
	@Override
	public int measureWidth() {
		return mFrame.height();
	}
}
